<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>番剧列表展示</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        body {
            font-family: 'Microsoft YaHei', sans-serif;
            color: #333;
            background-image: url('{{pluResPath}}{{bgImagePath}}');
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            min-height: 100vh;
            padding: 20px 0;
        }
        .header {
            display: none; /* 隐藏标头 */
        }
        .container {
            width: 98%;
            max-width: 1200px;
            margin: 0 auto;
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 16px;
            padding: 20px;
            background-color: rgba(255, 255, 255, 0.2);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border-radius: 16px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
        }
        .item {
            display: flex;
            flex-direction: column;
            border-radius: 12px;
            overflow: hidden;
            background-color: #fff;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            position: relative;
            height: 100%;
            border: 1px solid rgba(0, 0, 0, 0.05);
        }
        .item-image {
            position: relative;
            width: 100%;
            height: 0;
            padding-top: 100%; /* 方形图片比例 */
            overflow: hidden;
        }
        .item-image img {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .item-details {
            padding: 10px;
            display: flex;
            flex-direction: column;
            background-color: #fff;
        }
        .item-name {
            font-size: 14px;
            font-weight: 600;
            color: #333;
            text-decoration: none;
            line-height: 1.3;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 1;
            -webkit-box-orient: vertical;
            margin-bottom: 6px;
        }
        .item-stats {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 4px;
        }
        .item-score {
            font-weight: bold;
            font-size: 14px;
            color: #FF9500;
            white-space: nowrap;
            background-color: rgba(255, 149, 0, 0.1);
            padding: 2px 8px;
            border-radius: 100px;
        }
        .item-watching {
            display: flex;
            align-items: center;
            color: #8E8E93;
            font-size: 12px;
        }
        .item-watching-icon {
            margin-right: 3px;
            width: 12px;
            height: 12px;
            display: inline-block;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%238E8E93'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z'/%3E%3C/svg%3E");
            background-size: contain;
            background-repeat: no-repeat;
        }
        .item-date {
            color: #8E8E93;
            font-size: 12px;
            display: flex;
            justify-content: space-between;
        }
        
        .no-data, .error {
            text-align: center;
            padding: 30px;
            color: #333;
            font-size: 16px;
            background-color: rgba(255, 255, 255, 0.9);
            border-radius: 12px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            grid-column: 1 / -1;
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
        }
        .error {
            color: #FF3B30;
        }
        
        .page-title {
            text-align: center;
            margin-bottom: 20px;
            color: #fff;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
            font-size: 2rem;
            font-weight: 600;
        }

        /* 自定义评分颜色 */
        .score-high {
            color: #FF9500;
            background-color: rgba(255, 149, 0, 0.1);
        }
        .score-medium {
            color: #34C759;
            background-color: rgba(52, 199, 89, 0.1);
        }
        .score-low {
            color: #FF3B30;
            background-color: rgba(255, 59, 48, 0.1);
        }
        .score-none {
            color: #8E8E93;
            background-color: rgba(142, 142, 147, 0.1);
        }
        
        /* 星期标签样式 */
        .weekday-tag {
            background-color: #007AFF;
            color: white;
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 10px;
            font-weight: bold;
            margin-left: 5px;
        }
        
        /* 星期分组样式 */
        .weekday-group {
            grid-column: 1 / -1;
            margin-top: 15px;
            margin-bottom: 5px;
            padding: 8px 15px;
            background-color: rgba(0, 122, 255, 0.1);
            border-radius: 10px;
            font-weight: bold;
            color: #007AFF;
            display: flex;
            align-items: center;
        }
        
        .weekday-group-icon {
            margin-right: 6px;
            font-size: 18px;
        }
        
        /* 在小屏幕上展示2列 */
        @media (max-width: 480px) {
            .container {
                grid-template-columns: repeat(2, 1fr);
                gap: 12px;
                padding: 15px;
            }
            .item-name {
                font-size: 12px;
            }
            .item-watching, .item-date {
                font-size: 10px;
            }
            .item-score {
                font-size: 12px;
            }
        }
        
        /* 在中等屏幕上展示3列 */
        @media (min-width: 481px) and (max-width: 768px) {
            .container {
                grid-template-columns: repeat(3, 1fr);
                gap: 14px;
            }
        }
        
        /* 在大屏幕上展示4列 */
        @media (min-width: 769px) {
            .container {
                grid-template-columns: repeat(4, 1fr);
                gap: 16px;
            }
        }
    </style>
</head>
<body>
    <div class="header">
        <h1>{{title || '今日热门番剧'}}</h1>
        <h2>鸢尾花插件</h2>
    </div>
    
    <h1 class="page-title">{{title || '今日热门番剧'}}</h1>
    
    <div class="container" id="anime-list">
        {{if title === '本周番剧'}}
            <!-- 本周番剧，按星期分组显示 -->
            {{each weekGroups group}}
                <div class="weekday-group">
                    <span class="weekday-group-icon">📅</span>
                    <span>{{group.weekday}}</span>
                </div>
                {{each group.items anime}}
                <div class="item">
                    <div class="item-image">
                        <img src="{{anime.images.large || anime.images.common || ''}}" alt="{{anime.name_cn || anime.name || '未知番剧'}}">
                    </div>
                    <div class="item-details">
                        <a href="{{anime.url || '#'}}" target="_blank" class="item-name">{{anime.name_cn || anime.name || '未知番剧'}}</a>
                        <div class="item-stats">
                            <div class="item-watching">
                                <span class="item-watching-icon"></span>
                                <span>{{anime.collection ? (anime.collection.doing || 0).toLocaleString() : 0}} 人在看</span>
                            </div>
                            <div class="item-score {{anime.rating && anime.rating.score ? (anime.rating.score >= 8 ? 'score-high' : (anime.rating.score >= 6 ? 'score-medium' : 'score-low')) : 'score-none'}}">
                                {{anime.rating && anime.rating.score ? anime.rating.score : '暂无'}}
                            </div>
                        </div>
                        <div class="item-date">
                            <span>{{anime.air_date || '未知日期'}}</span>
                        </div>
                    </div>
                </div>
                {{/each}}
            {{/each}}
        {{else}}
            <!-- 今日或昨日番剧，直接显示 -->
            {{each animeData anime}}
            <div class="item">
                <div class="item-image">
                    <img src="{{anime.images.large || anime.images.common || ''}}" alt="{{anime.name_cn || anime.name || '未知番剧'}}">
                </div>
                <div class="item-details">
                    <a href="{{anime.url || '#'}}" target="_blank" class="item-name">{{anime.name_cn || anime.name || '未知番剧'}}</a>
                    <div class="item-stats">
                        <div class="item-watching">
                            <span class="item-watching-icon"></span>
                            <span>{{anime.collection ? (anime.collection.doing || 0).toLocaleString() : 0}} 人在看</span>
                        </div>
                        <div class="item-score {{anime.rating && anime.rating.score ? (anime.rating.score >= 8 ? 'score-high' : (anime.rating.score >= 6 ? 'score-medium' : 'score-low')) : 'score-none'}}">
                            {{anime.rating && anime.rating.score ? anime.rating.score : '暂无'}}
                        </div>
                    </div>
                    <div class="item-date">
                        <span>{{anime.air_date || '未知日期'}}</span>
                        {{if anime.dayOfWeek}}
                        <span class="weekday-tag">{{anime.dayOfWeek}}</span>
                        {{/if}}
                    </div>
                </div>
            </div>
            {{/each}}
        {{/if}}
    </div>
</body>
</html> 